home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / Think C dcmd 1.0.1 ƒ / Think Put Lib source / __HexToText.c < prev    next >
Encoding:
Text File  |  1994-06-12  |  247 b   |  13 lines  |  [TEXT/KAHL]

  1. void __HexToText (unsigned long hex, char* str, short size  /* 0=word, 1=long */ )
  2. {
  3.         int         n, len;
  4.         char*     digits = "0123456789ABCDEF";
  5.     
  6.     len = size ? 8-1 : 4-1;
  7.     
  8.     for ( n = len; n >= 0; n-- )
  9.     {
  10.         str[n] = digits[hex % 16];
  11.         hex /= 16;
  12.     }
  13. }